<?php

class SiteController extends FController
{
	public $layout='//layouts/main';   
	/* 
		Function init can not set default theme for this controller
		It must be set in earch action
	*/ 
	
	// public function init()
	// {
		// Yii::app()->theme = 'frontend';
		// parent::init();
	// }

	public function actionViewCart()
	{
		
		$this->render('viewcart');
	}
	
	/**
	 * This is the action to handle external exceptions.
	 */
	public function actionIndex()
	{
		// if (Yii::app()->user->isGuest) {
			// $this->redirect('/user/login');
		// } else 
			$this->render('index');
	}
	
	/**
	 * This is the action to handle external exceptions.
	 */
	public function actionError()
	{
	    if($error=Yii::app()->errorHandler->error)
	    {
	    	if(Yii::app()->request->isAjaxRequest)
	    		echo $error['message'];
	    	else
	        	$this->render('error', $error);
	    }
	}
}
